//    Copyright (C) Kherty.  All rights reserved.
using System;
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    public abstract class TextAutofit : IOfficeXmlSerializable
    {
        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            ReadXmlCore(context);
        }

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            WriteXmlCore(context);
        }

        #endregion

        internal static TextAutofit ReadTextAutofit(ReadContext c)
        {
            switch (c.ReaderLocalName)
            {
                case "normAutofit":
                    TextNormalAutofit r = new TextNormalAutofit();
                    r.ReadXmlCore(c);
                    return r;
                case "spAutoFit":
                    TextShapeAutofit a = new TextShapeAutofit();
                    a.ReadXmlCore(c);
                    return a;
                case "noAutofit":
                    TextNoAutofit n = new TextNoAutofit();
                    n.ReadXmlCore(c);
                    return n;
                default:
                    return null;
            }
        }

        internal abstract void ReadXmlCore(ReadContext context);

        internal abstract void WriteXmlCore(WriteContext context);
    }
}